// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App.vue'
import store from './store' // 引入vuex
import router from './router'

import '@/assets/css/reset.css' // 重置less
import 'lib-flexible/flexible' // 大屏适配布局（搭配 px2rem-loader）
import axios from '@/utils/request' // axios封装引入
import plugin from '@/common/index' // 公共组件
import VueClipboard from 'vue-clipboard2' // copy复制组件
import VueI18n from 'vue-i18n' // 国际语言包
import i18n from '@/utils/i18n'
import Navigation from 'vue-navigation' // 缓存组件
import Vant from 'vant'
import 'vant/lib/index.css'
import websocket from '@/utils/websocketStore.js'
// 重新指向
Vue.prototype.$https = axios
Vue.prototype.$websocket = websocket
// vue注册
Vue.use(plugin)
  .use(VueI18n)
  .use(VueClipboard)
  .use(Vant)
  .use(Navigation, { router })

// 测试环境打开vue tools
Vue.config.devtools = true

Vue.config.productionTip = false

Vue.filter('toFixed', function (value, decimal = 2) {
  if (typeof value === 'string') {
    value = parseFloat(value)
  }
  return value && value.toFixed(decimal)
})

/* eslint-disable no-new */
var vue = new Vue({
  el: '#app',
  i18n,
  router,
  store,
  components: { App },
  template: '<App/>'
})

export default vue
